'use strict';
var transDate = require('./transDate.js');

function userInfo(user_id) {
  var info;
  var orgId;
  var depId;
  var orgName;
  var depName;
  var time;
  var perId;
  //提取部门号组织号个人号
  orgId = user_id.slice(0, 2);
  depId = user_id.slice(2, 4);
  perId = user_id.slice(4);
  //计算部门组织
  switch (orgId) {
    case '01':
      orgName = '指导老师';
      switch (depId) {
        case '01':
          depName = '指导老师';
          break;
      }
      break;
    case '02':
      orgName = '西电官微';
      switch (depId) {
        case '00':
          depName = '负责人';
          break;
        case '01':
          depName = '采编部';
          break;
        case '02':
          depName = '视觉部';
          break;
        case '03':
          depName = '秘书部';
          break;
        case '04':
          depName = '技术部';
          break;
      }
      break;
    case '03':
      orgName = '西电官博';
      break;
    case '04':
      orgName = '西电哔哩哔哩';
      break;
    case '05':
      orgName = '西电小喇叭';
      break;
    case '06':
      orgName = '714影音工作室';
      break;
    case '07':
      orgName = '西电科大报';
      break;
    case '08':
      orgName = '雁塔晨钟';
      break;
  }
  //计算用户注册时间
  time = transDate(perId);
  info = {
    orgId: orgId,
    orgName: orgName,
    depId: depId,
    depName: depName,
    time: time
  }
  return info;
}
module.exports = userInfo;